package com.jx.gocomtask.webservice.entity.listener;

import java.util.stream.Collectors;

import javax.persistence.PostLoad;

import com.jx.gocomtask.webservice.DTO.TaskScope;
import com.jx.gocomtask.webservice.entity.ExtTaskTodo;


public class ExtTaskTodoListener {
	private static org.slf4j.Logger logger = org.slf4j.LoggerFactory.getLogger(ExtTaskTodoListener.class);
	@PostLoad 
	public void postLoad(Object entity) {
		if (entity.getClass() ==ExtTaskTodo.class){
			ExtTaskTodo extTaskTodo=(ExtTaskTodo)entity;
			String trueName=extTaskTodo.getExtTaskTodoUsers().stream().map(t->t.getTaskUserName()).collect(Collectors.joining(","));
			if(extTaskTodo.getScope()==TaskScope.ALL){
				trueName="全体人员";
			}
			extTaskTodo.setExecerList(trueName);
		}
	}
}